package com.xy.smartsms.db.carrierparam.entity;

import android.content.ContentValues;

/**
 * Created by admin on 2016/11/24.
 */

public class BlackListItem {
    private int id;
    private String phone;
    private long funcBitwise;
    private long displayBitwise;
    private String extend;
    private String version;
    private long lastUpdateTime;
    private int lastUpdateStatus;

    public static final int STATUS_SUCCESS = 1;
    public static final int STATUS_FAIL = 2;

    private int status = 0;
    public static final int STATUS_LOAD_DEFULT = 0;
    public static final int STATUS_LOAD_SUC_HAS_DATA = 1;
    public static final int STATUS_LOAD_SUC_NOT_DATA = 2;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public BlackListItem() {
    }

    public BlackListItem(String phone) {
        this.phone = phone;
        this.version = "0";
        this.funcBitwise = 0L;
        this.displayBitwise = 0L;
        // ensure to update at first time
        this.lastUpdateTime = 0L;
        this.lastUpdateStatus = STATUS_SUCCESS;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(" phone:" + this.phone);
        sb.append(" func:" + this.funcBitwise);
        sb.append(" display:" + this.displayBitwise);
        sb.append(" version:" + this.version);
        return sb.toString();
    }

    public ContentValues getContentValues() {
        ContentValues values = new ContentValues();

        values.put(BlackListDb.KEY_PHONE, this.phone);
        values.put(BlackListDb.KEY_FUNC_BITWISE, this.funcBitwise);
        values.put(BlackListDb.KEY_DISPLAY_BITWISE, this.displayBitwise);
        values.put(BlackListDb.KEY_EXTEND, this.extend);
        values.put(BlackListDb.KEY_VERSION, this.version);
        values.put(BlackListDb.KEY_LAST_UPDATE_TIME, this.lastUpdateTime);
        values.put(BlackListDb.KEY_LAST_UPDATE_STATUS, this.lastUpdateStatus);

        return values;
    }

    public String getPhone() {
        return phone;
    }

    public BlackListItem setPhone(String phone) {
        this.phone = phone;
        return this;
    }

    public long getFuncBitwise() {
        return funcBitwise;
    }

    public BlackListItem setFuncBitwise(long funcBitwise) {
        this.funcBitwise = funcBitwise;
        return this;
    }

    public long getDisplayBitwise() {
        return displayBitwise;
    }

    public BlackListItem setDisplayBitwise(long displayBitwise) {
        this.displayBitwise = displayBitwise;
        return this;
    }

    public int getId() {
        return this.id;
    }

    public String getExtend() {
        return extend;
    }

    public BlackListItem setExtend(String extend) {
        this.extend = extend;
        return this;
    }

    public String getVersion() {
        return version;
    }

    public BlackListItem setVersion(String version) {
        this.version = version;
        return this;
    }

    public long getLastUpdateTime() {
        return lastUpdateTime;
    }

    public BlackListItem setLastUpdateTime(long lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
        return this;
    }

    public int getLastUpdateStatus() {
        return lastUpdateStatus;
    }

    public BlackListItem setLastUpdateStatus(int lastUpdateStatus) {
        this.lastUpdateStatus = lastUpdateStatus;
        return this;
    }

    public void setId(int id) {
        this.id = id;
    }
}
